<template>
	<view class="bigBox">
		<u-navbar leftIconColor='#fff' :autoBack="true" bgColor='#000' title='我的订单' titleStyle="color:#fff;">
		</u-navbar>
		<view
			style="width: 750rpx;height: 100rpx;background-color: #000;display: flex;align-items: center;justify-content: center;">
			<u-tabs :list="list" :current='pageIndex' @click="click" :itemStyle="{height: '100rpx'}" lineWidth='0'
				:inactiveStyle="{color:'#bfbfbf',transform: 'scale(1)',fontWeight:400}"
				:activeStyle="{fontWeight:700,color:'#fff',transform: 'scale(1.1)'}"></u-tabs>
		</view>
		<swiper :style="{width: '750rpx','height': bodyheight+'px'}" :current="pageIndex" :interval="2000"
			@change="pageChange">
			<swiper-item>
				<scroll-view :scroll-y="true"
					:style="{'height': bodyheight+'px','white-space':'nowrap','padding-bottom': '300rpx'}">
					<template v-for="father in 3">
						<view class="shopBox">
							<view class="box">
								<view class="orderNumber" @click="goDetail">
									<view class="number">订单编号：SY938394751023</view>
									<view class="text">待付款</view>
								</view>
								<template v-for="item in 4">
									<view class="shopDetails">
										<u-avatar :src="src" shape="square" size='160rpx'></u-avatar>
										<view class="details">
											<text class="name">索尼（SONY）KDL-50W660F 50英寸全高清液晶电视（黑色）</text>
											<view class="price">
												<view class="tabs">
													<template v-for="item in 2">
														<view class="tabBtn">单人沙发</view>
													</template>
													<text class="text">X 1</text>
												</view>
												<view class="number">¥1288.00</view>
											</view>
										</view>
									</view>
								</template>
								<view class="money">
									<view></view>
									<view class="text">
										实付金额: <text class="number">¥ 800.00</text>
									</view>
								</view>
								<view class="shop">
									<view class="left">
										<u-avatar :src="src" shape="square" size='40rpx'></u-avatar>
										<view class="text">Santa Marche圣马赫官方旗舰店</view>
									</view>
									<view class="right">
										<view class="cancel">取消订单</view>
										<view class="pay">支付订单</view>
									</view>
								</view>
							</view>
						</view>
					</template>
				</scroll-view>
			</swiper-item>
			<swiper-item>
				1
			</swiper-item>
			<swiper-item>
				1
			</swiper-item>
			<swiper-item>
				1
			</swiper-item>
			<swiper-item>
				1
			</swiper-item>
			<swiper-item>
				1
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bodyheight: 0,
				pageIndex: 0,
				src:'https://cdn.uviewui.com/uview/album/5.jpg',
				list: [{
						name: "全部"
					},
					{
						name: "待付款"
					},
					{
						name: "待发货"
					},
					{
						name: "待收货"
					},
					{
						name: "已完成"
					},
					{
						name: "已取消"
					}
				],

			}
		},
		onLoad(option) {
			console.log(option)
			this.Getheight()
			console.log(this.bodyheight)
		},
		methods: {
			goDetail(){
				uni.navigateTo({
					url:`/pages/shop/orderDetail`
				})
			},
			click(index) {
				this.pageIndex = index.index;
			},
			pageChange(e) {
				this.pageIndex = e.detail.current;
				console.log(e)
			},
			Getheight() {
				uni.getSystemInfo({
					success: (e) => {
						// this.compareVersion(e.SDKVersion, '2.5.0')
						let statusBar = 0;
						let customBar = 0;
						// #ifdef MP
						statusBar = e.statusBarHeight
						customBar = e.statusBarHeight + 45
						if (e.platform === 'android') {
							this.$store.commit('SET_SYSTEM_IOSANDROID', false)
							customBar = e.statusBarHeight + 50
						}
						// #endif


						// #ifdef MP-WEIXIN
						statusBar = e.statusBarHeight
						// @ts-ignore
						const custom = wx.getMenuButtonBoundingClientRect()
						customBar = custom.bottom + custom.top - e.statusBarHeight
						// #endif


						// #ifdef MP-ALIPAY
						statusBar = e.statusBarHeight
						customBar = e.statusBarHeight + e.titleBarHeight
						// #endif


						// #ifdef APP-PLUS
						statusBar = e.statusBarHeight;
						customBar = e.statusBarHeight + 45
						// #endif


						// #ifdef H5
						statusBar = 0
						customBar = e.statusBarHeight + 45
						// #endif
						// this.statusBarHeight = statusBar;
						// this.bodyheight= (e.windowHeight - statusBar -46);
						this.bodyheight = (e.windowHeight - statusBar - 100);
						// this.windowWidth = e.screenWidth;
					}
				})

			},
		}
	}
</script>

<style>
	.bigBox {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 750rpx;
		padding-top: 160rpx;
		background-color: #F8F8F8;
	}
</style>
<style lang="less">
	.shopBox {
		margin: 20rpx 0;
		width: 750rpx;
		display: flex;
		justify-content: center;
		align-items: center;

		.box {
			display: flex;
			flex-direction: column;
			width: 670rpx;
			background-color: #fff;
			padding: 20rpx;
			.shop{
				margin-top: 40rpx;
				width: 670rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.left{
					display: flex;
					align-items: center;
					.text{
						margin-left: 20rpx;
						color: rgba(190, 199, 209, 100);
						font-size: 20rpx;
					}
				}
				.right{
					display: flex;
					align-items: center;
					.cancel{
						color: rgba(190, 199, 209, 100);
						font-size: 24rpx;
						margin-right: 20rpx;
					}
					.pay{
						width: 160rpx;
						height: 60rpx;
						line-height: 60rpx;
						background-color: rgba(254, 76, 70, 100);
						color: rgba(255, 255, 255, 100);
						font-size: 24rpx;
						text-align: center;
					}
				}
			}
			.money{
				width: 670rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.text{
					color: rgba(190, 199, 209, 100);
					font-size: 14px;
					.number{
						font-weight: 700;
						font-size: 32rpx;
						color: #FE4C46;
					}
				}
			}
			.orderNumber {
				display: flex;
				justify-content: space-between;

				.number {
					color: rgba(190, 199, 209, 100);
					font-size: 24rpx;
				}

				.text {
					color: rgba(254, 76, 70, 100);
					font-size: 24rpx;
					font-weight: 700;
				}
			}

			.shopDetails {
				margin-top: 2rpx;
				width: 670rpx;
				height: 208rpx;
				background-color: #fff;
				display: flex;
				align-items: center;

				.details {
					width: 490rpx;
					height: 208rpx;
					margin-left: 20rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-around;

					.name {
						font-weight: 700;
						color: rgba(0, 7, 15, 100);
						font-size: 24rpx;
						word-wrap: break-word;
						word-break: break-all;
						white-space: pre-line;
					}

					.price {
						display: flex;
						align-items: center;
						justify-content: space-between;

						.tabs {
							display: flex;
							align-items: center;

							.tabBtn {
								padding: 0 10rpx;
								height: 40rpx;
								line-height: 40rpx;
								background-color: rgba(248, 248, 248, 100);
								color: rgba(190, 199, 209, 100);
								font-size: 20rpx;
								margin-right: 10rpx;
							}

							.text {
								color: rgba(190, 199, 209, 100);
								font-size: 20rpx;
							}
						}

						.number {
							color: rgba(12, 16, 47, 100);
							font-size: 28rpx;
						}
					}
				}
			}
		}
	}
</style>
